package com.leetroll.common.config.listener;

import com.leetroll.common.utils.UserUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.ServletRequestHandledEvent;

@Slf4j
@Component
public class ServletRequestHandledEventListener implements ApplicationListener<ServletRequestHandledEvent> {

    @Override
    public void onApplicationEvent(ServletRequestHandledEvent event) {
        log.debug("Listener remove userId {}", UserUtil.getUserId());
        UserUtil.remove();
    }
}
